<template>
  <div class="page-sheet doc-title">
    <p
      v-if="showSource"
      style="
        position: absolute;
        top: -5mm;
        width: 100%;
        left: 10mm;
        text-decoration: underline;
        text-align: right;
        font-size: 1rem;
        color: #1890ff;
      "
    >
      <a :href="href" style="cursor: pointer">打开pdf源数据</a>
    </p>
    <p>{{ standardName }}</p>
    <p v-if="en">{{ standardNameEn }}</p>
  </div>
</template>

<script>
import { getLinkUrl } from '@/utils/helpers'
export default {
  computed: {
    showSource() {
      // 1. docSource === 2表示来自解析的文件
      // 2. _iframe表示用于引用选中的内容
      return this.$store.state.xmleditor.docSource === 2 && !this.$store.getters._iframe
    },
    en() {
      return this.$store.getters.languageType === 'both'
    },
    href() {
      return getLinkUrl(this.$store.state.xmleditor.publicFilePath)
    },
    standardName() {
      return this.$store.state.xmleditor.standardBaseInfo?.standardName
    },
    standardNameEn() {
      return this.$store.state.xmleditor.standardBaseInfo?.standardNameEn
    }
  }
}
</script>
